// 通用拖拽库类型定义

export interface DragComponentData {
  id: number | string
  type: string
  [key: string]: unknown // 允许组件特定的属性
}

export interface DragEventPayload {
  sourceData: DragComponentData
  sourceType?: string // 源类型，用于区分不同的拖拽源
  [key: string]: unknown
}

export interface DropPosition {
  index: number
  x: number
  y: number
}

export interface DragDropConfig {
  // 样式配置
  styles?: {
    placeholder?: React.CSSProperties
    dragging?: React.CSSProperties
    dropZone?: React.CSSProperties
  }
  
  // 回调函数
  onDrop?: (data: DragComponentData, position: DropPosition) => void
  onDragStart?: (payload: DragEventPayload) => void
  onDragEnd?: (payload: DragEventPayload) => void
}

export interface ComponentRenderer {
  (componentData: DragComponentData): React.ReactNode
}

export interface ComponentRegistry {
  [type: string]: ComponentRenderer
}